package Vistas;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;

import Controlador.CPosiciones;
import Principal.Liga;

import javax.swing.JLabel;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VPosiciones extends javax.swing.JFrame {
	private JPanel panel;
	private JButton btnsalir;
	private JLabel lblimagen;
	private JLabel lbldatos;
	private JScrollPane scrposicion;
	private JTable tablaposicion;

	
	public VPosiciones() {
		super();
		initGUI();
		setListado(new VLlenartablaposiciones(Liga.equipos));
		CPosiciones controlador = new CPosiciones(this);
		btnsalir.addActionListener(controlador);
		
	}
	ImageIcon icon = new ImageIcon("src\\Imagenes\\unicefLVBP.PNG");
	Image img = icon.getImage();
    Image newimg = img.getScaledInstance(246, 352,  java.awt.Image.SCALE_SMOOTH);
	ImageIcon newIcon = new ImageIcon(newimg);
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				panel = new JPanel();
				getContentPane().add(panel);
				panel.setBounds(264, 73, 335, 211);
				panel.setLayout(null);
				{
					JScrollPane scrposicion = new JScrollPane();
					panel.add(scrposicion);
					scrposicion.setBounds(0, 0, 340, 208);
					{
						tablaposicion = new JTable();
						scrposicion.setViewportView(tablaposicion);
					}
				}
				
			
			}
			{
				lbldatos = new JLabel();
				getContentPane().add(lbldatos);
				lbldatos.setText("TABLA DE POSICIONES");
				lbldatos.setBounds(319, 26, 265, 30);
				lbldatos.setFont(new java.awt.Font("Segoe UI",0,20));
			}
			{
				lblimagen = new JLabel();
				getContentPane().add(lblimagen);
				lblimagen.setBounds(0, 0, 246, 352);
				lblimagen.setIcon(newIcon);
			}
			{
				btnsalir = new JButton();
				getContentPane().add(btnsalir);
				btnsalir.setText("Salir");
				btnsalir.setBounds(504, 312, 72, 23);
			}
			pack();
			this.setSize(643, 390);
			setVisible(true);
			getContentPane().setBackground(new java.awt.Color(255,255,255));
			this.setTitle("Posiciones");
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void setListado(AbstractTableModel abstractTableModel){
		tablaposicion.setModel(abstractTableModel);
	}
}
